package com.ygh.controller;

import com.ygh.pojo.AdminUser;
import com.ygh.service.AdminUserService;
import com.ygh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdminUserController {
    @Autowired
    private AdminUserService adminUserService;

    @PostMapping ("/login")
    public SysResult getUser(@RequestBody AdminUser adminUser){
        String token=adminUserService.getadminUser(adminUser);
        if(StringUtils.hasLength(token)){
            return SysResult.success(token);
        }
        return SysResult.fail();
    }
}
